package com.szr.cloud.springboot_hello.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.fasterxml.jackson.core.sym.Name;
import com.szr.cloud.springboot_hello.service.UserServiceI;

import antlr.collections.List;

@RestController
@EnableAutoConfiguration
public class HelloWorld {
	
	@Value(value="${book.name}")
	private String name;
	
	@Autowired
	private UserServiceI userService;
	
	@RequestMapping("/")
	public String home(){
		return "Hello World!" + name;
	}
	
	@RequestMapping("/home/{name}")
	@ResponseBody
	public String index(@PathVariable(name="name")String name){
		return userService.getUserByName(name).toString();
	}
}
